import request from '@/utils/request'

// 获取商品列表
export function getGoodsComboList(query) {
  return request({
    url: '/goods/combo/paging',
    method: 'get',
    params: query
  })
}

// 上架商品
export function upComboGoods(comboGoodsId, enterpriseId) {
  if (!comboGoodsId) {
    return false
  }
  return request({
    url: '/goods/combo/doUpComboGoods',
    method: 'post',
    params: {
      comboGoodsId: comboGoodsId,
      enterpriseId: enterpriseId
    }
  })
}

// 下架商品
export function downComboGoods(comboGoodsId) {
  if (!comboGoodsId) {
    return false
  }
  return request({
    url: '/goods/combo/doDownComboGoods',
    method: 'post',
    params: { comboGoodsId: comboGoodsId }
  })
}

// 删除
export function deleteComboGoods(comboGoodsId) {
  return request({
    url: '/goods/combo/delete',
    method: 'post',
    params: { comboGoodsId: comboGoodsId }
  })
}

// 套餐子商品查询
export function listGoodsForSelect(query) {
  return request({
    url: '/goods/combo/listGoodsForSelect',
    method: 'get',
    params: query
  })
}

// 套餐子商品查询
export function listSubGoods(goodsId, enterpriseId) {
  return request({
    url: '/goods/combo/listSubGoods',
    method: 'get',
    params: {
      goodsId: goodsId,
      enterpriseId: enterpriseId
    }
  })
}
